#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
using namespace std;

int N;
int w[maxn][3];
int f[maxn][3];
int main(){
    // debug;
    ios;
    cin>>N;
    for(int i = 1;i<=N;i++) cin>>w[i][0]>>w[i][1]>>w[i][2];
    f[1][0] = w[1][0],f[1][1] = w[1][1],f[1][2] = w[1][2];
    for(int i = 2;i<=N;i++){
        for(int j = 0;j<3;j++){
            for(int k = 0;k<3;k++){
                if(j != k) f[i][j] = max(f[i][j],f[i-1][k] + w[i][j]);
            }
        }
    }
    cout<<max(max(f[N][0],f[N][1]),f[N][2])<<'\n';


    
    return 0;
}
